home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / gdb / m2-exp.tab.c < prev    next >
C/C++ Source or Header  |  1992-09-11  |  66KB  |  2,168 lines

  1.  
  2. /*  A Bison parser, made from ./m2-exp.y  */
  3.  
  4. #define    INT    258
  5. #define    HEX    259
  6. #define    ERROR    260
  7. #define    UINT    261
  8. #define    TRUE    262
  9. #define    FALSE    263
  10. #define    CHAR    264
  11. #define    FLOAT    265
  12. #define    STRING    266
  13. #define    NAME    267
  14. #define    BLOCKNAME    268
  15. #define    IDENT    269
  16. #define    CONST    270
  17. #define    VARNAME    271
  18. #define    TYPENAME    272
  19. #define    SIZE    273
  20. #define    CAP    274
  21. #define    ORD    275
  22. #define    HIGH    276
  23. #define    ABS    277
  24. #define    MIN    278
  25. #define    MAX    279
  26. #define    FLOAT_FUNC    280
  27. #define    VAL    281
  28. #define    CHR    282
  29. #define    ODD    283
  30. #define    TRUNC    284
  31. #define    INC    285
  32. #define    DEC    286
  33. #define    INCL    287
  34. #define    EXCL    288
  35. #define    COLONCOLON    289
  36. #define    LAST    290
  37. #define    REGNAME    291
  38. #define    INTERNAL_VAR    292
  39. #define    ABOVE_COMMA    293
  40. #define    ASSIGN    294
  41. #define    LEQ    295
  42. #define    GEQ    296
  43. #define    NOTEQUAL    297
  44. #define    IN    298
  45. #define    OR    299
  46. #define    AND    300
  47. #define    DIV    301
  48. #define    MOD    302
  49. #define    UNARY    303
  50. #define    DOT    304
  51. #define    NOT    305
  52. #define    QID    306
  53.  
  54. #line 31 "./m2-exp.y"
  55.  
  56. #include <stdio.h>
  57. #include <string.h>
  58. #include "defs.h"
  59. #include "param.h"
  60. #include "symtab.h"
  61. #include "frame.h"
  62. #include "expression.h"
  63. #include "language.h"
  64. #include "value.h"
  65. #include "parser-defs.h"
  66.  
  67. /* These MUST be included in any grammar file!!!!
  68.    Please choose unique names! */
  69. #define    yyparse    m2_parse
  70. #define    yylex    m2_lex
  71. #define    yyerror    m2_error
  72. #define    yylval    m2_lval
  73. #define    yychar    m2_char
  74. #define    yydebug    m2_debug
  75. #define    yypact    m2_pact
  76. #define    yyr1    m2_r1
  77. #define    yyr2    m2_r2
  78. #define    yydef    m2_def
  79. #define    yychk    m2_chk
  80. #define    yypgo    m2_pgo
  81. #define    yyact    m2_act
  82. #define    yyexca    m2_exca
  83. #define yyerrflag m2_errflag
  84. #define yynerrs    m2_nerrs
  85. #define    yyps    m2_ps
  86. #define    yypv    m2_pv
  87. #define    yys    m2_s
  88. #define    yystate    m2_state
  89. #define    yytmp    m2_tmp
  90. #define    yyv    m2_v
  91. #define    yyval    m2_val
  92. #define    yylloc    m2_lloc
  93.  
  94. /* Forward decl's */
  95. void yyerror ();
  96. static int yylex ();
  97. int yyparse ();
  98.  
  99. /* The sign of the number being parsed. */
  100. int number_sign = 1;
  101.  
  102. /* The block that the module specified by the qualifer on an identifer is
  103.    contained in, */
  104. struct block *modblock=0;
  105.  
  106. char *make_qualname();
  107.  
  108. /* #define    YYDEBUG    1 */
  109.  
  110.  
  111. #line 92 "./m2-exp.y"
  112. typedef union
  113.   {
  114.     LONGEST lval;
  115.     unsigned LONGEST ulval;
  116.     double dval;
  117.     struct symbol *sym;
  118.     struct type *tval;
  119.     struct stoken sval;
  120.     int voidval;
  121.     struct block *bval;
  122.     enum exp_opcode opcode;
  123.     struct internalvar *ivar;
  124.  
  125.     struct type **tvec;
  126.     int *ivec;
  127.   } YYSTYPE;
  128.  
  129. #ifndef YYLTYPE
  130. typedef
  131.   struct yyltype
  132.     {
  133.       int timestamp;
  134.       int first_line;
  135.       int first_column;
  136.       int last_line;
  137.       int last_column;
  138.       char *text;
  139.    }
  140.   yyltype;
  141.  
  142. #define YYLTYPE yyltype
  143. #endif
  144.  
  145. #include <stdio.h>
  146.  
  147. #ifndef __STDC__
  148. #define const
  149. #endif
  150.  
  151.  
  152.  
  153. #define    YYFINAL        185
  154. #define    YYFLAG        -32768
  155. #define    YYNTBASE    71
  156.  
  157. #define YYTRANSLATE(x) ((unsigned)(x) <= 306 ? yytranslate[x] : 85)
  158.  
  159. static const char yytranslate[] = {     0,
  160.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  161.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  162.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  163.      2,     2,     2,     2,    47,     2,     2,    51,     2,    63,
  164.     67,    55,    53,    38,    54,     2,    56,     2,     2,     2,
  165.      2,     2,     2,     2,     2,     2,     2,     2,     2,    41,
  166.     45,    42,     2,    52,     2,     2,     2,     2,     2,     2,
  167.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  168.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  169.     62,     2,    70,    60,     2,     2,     2,     2,     2,     2,
  170.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  171.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  172.      2,     2,    68,     2,    69,    65,     2,     2,     2,     2,
  173.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  174.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  175.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  176.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  177.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  178.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  179.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  180.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  181.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  182.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  183.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  184.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  185.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  186.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  187.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  188.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  189.     36,    37,    39,    40,    43,    44,    46,    48,    49,    50,
  190.     57,    58,    59,    61,    64,    66
  191. };
  192.  
  193. static const short yyprhs[] = {     0,
  194.      0,     2,     4,     6,     9,    10,    14,    17,    20,    22,
  195.     24,    29,    34,    39,    44,    49,    54,    59,    66,    71,
  196.     76,    81,    84,    89,    96,   101,   108,   112,   114,   118,
  197.    125,   132,   136,   141,   142,   148,   149,   155,   156,   158,
  198.    162,   164,   168,   173,   178,   182,   186,   190,   194,   198,
  199.    202,   206,   210,   214,   218,   222,   226,   230,   234,   238,
  200.    242,   246,   250,   254,   256,   258,   260,   262,   264,   266,
  201.    268,   270,   272,   277,   279,   281,   283,   287,   289,   291,
  202.    295,   297
  203. };
  204.  
  205. static const short yyrhs[] = {    73,
  206.      0,    72,     0,    84,     0,    73,    60,     0,     0,    54,
  207.     74,    73,     0,    53,    73,     0,    75,    73,     0,    64,
  208.      0,    65,     0,    19,    63,    73,    67,     0,    20,    63,
  209.     73,    67,     0,    22,    63,    73,    67,     0,    21,    63,
  210.     73,    67,     0,    23,    63,    84,    67,     0,    24,    63,
  211.     84,    67,     0,    25,    63,    73,    67,     0,    26,    63,
  212.     84,    38,    73,    67,     0,    27,    63,    73,    67,     0,
  213.     28,    63,    73,    67,     0,    29,    63,    73,    67,     0,
  214.     18,    73,     0,    30,    63,    73,    67,     0,    30,    63,
  215.     73,    38,    73,    67,     0,    31,    63,    73,    67,     0,
  216.     31,    63,    73,    38,    73,    67,     0,    73,    61,    12,
  217.      0,    76,     0,    73,    48,    76,     0,    32,    63,    73,
  218.     38,    73,    67,     0,    33,    63,    73,    38,    73,    67,
  219.      0,    68,    79,    69,     0,    84,    68,    79,    69,     0,
  220.      0,    73,    62,    77,    80,    70,     0,     0,    73,    63,
  221.     78,    79,    67,     0,     0,    73,     0,    79,    38,    73,
  222.      0,    73,     0,    80,    38,    73,     0,    68,    84,    69,
  223.     73,     0,    84,    63,    73,    67,     0,    63,    73,    67,
  224.      0,    73,    52,    73,     0,    73,    55,    73,     0,    73,
  225.     56,    73,     0,    73,    57,    73,     0,    73,    58,    73,
  226.      0,    73,    53,    73,     0,    73,    54,    73,     0,    73,
  227.     45,    73,     0,    73,    46,    73,     0,    73,    47,    73,
  228.      0,    73,    43,    73,     0,    73,    44,    73,     0,    73,
  229.     41,    73,     0,    73,    42,    73,     0,    73,    50,    73,
  230.      0,    73,    51,    73,     0,    73,    49,    73,     0,    73,
  231.     40,    73,     0,     7,     0,     8,     0,     3,     0,     6,
  232.      0,     9,     0,    10,     0,    83,     0,    35,     0,    36,
  233.      0,    18,    63,    84,    67,     0,    11,     0,    82,     0,
  234.     13,     0,    81,    34,    13,     0,    82,     0,    37,     0,
  235.     81,    34,    12,     0,    12,     0,    17,     0
  236. };
  237.  
  238. #if YYDEBUG != 0
  239. static const short yyrline[] = { 0,
  240.    161,   162,   165,   174,   177,   179,   184,   188,   192,   193,
  241.    196,   200,   204,   208,   212,   218,   224,   228,   234,   238,
  242.    242,   246,   251,   255,   261,   265,   271,   277,   280,   284,
  243.    288,   291,   293,   299,   304,   310,   314,   320,   323,   327,
  244.    332,   337,   342,   348,   354,   362,   366,   370,   374,   378,
  245.    382,   386,   390,   394,   396,   400,   404,   408,   412,   416,
  246.    420,   424,   428,   435,   441,   447,   454,   463,   471,   478,
  247.    482,   488,   494,   501,   508,   512,   521,   533,   540,   547,
  248.    561,   625
  249. };
  250.  
  251. static const char * const yytname[] = {   "$",
  252. "error","$illegal.","INT","HEX","ERROR","UINT","TRUE","FALSE","CHAR","FLOAT",
  253. "STRING","NAME","BLOCKNAME","IDENT","CONST","VARNAME","TYPENAME","SIZE","CAP","ORD",
  254. "HIGH","ABS","MIN","MAX","FLOAT_FUNC","VAL","CHR","ODD","TRUNC","INC",
  255. "DEC","INCL","EXCL","COLONCOLON","LAST","REGNAME","INTERNAL_VAR","','","ABOVE_COMMA","ASSIGN",
  256. "'<'","'>'","LEQ","GEQ","'='","NOTEQUAL","'#'","IN","OR","AND",
  257. "'&'","'@'","'+'","'-'","'*'","'/'","DIV","MOD","UNARY","'^'",
  258. "DOT","'['","'('","NOT","'~'","QID","')'","'{'","'}'","']'",
  259. "start","type_exp","exp","@1","not_exp","set","@2","@3","arglist","non_empty_arglist",
  260. "block","fblock","variable","type",""
  261. };
  262. #endif
  263.  
  264. static const short yyr1[] = {     0,
  265.     71,    71,    72,    73,    74,    73,    73,    73,    75,    75,
  266.     73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
  267.     73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
  268.     73,    76,    76,    77,    73,    78,    73,    79,    79,    79,
  269.     80,    80,    73,    73,    73,    73,    73,    73,    73,    73,
  270.     73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
  271.     73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
  272.     73,    73,    73,    73,    81,    82,    82,    83,    83,    83,
  273.     83,    84
  274. };
  275.  
  276. static const short yyr2[] = {     0,
  277.      1,     1,     1,     2,     0,     3,     2,     2,     1,     1,
  278.      4,     4,     4,     4,     4,     4,     4,     6,     4,     4,
  279.      4,     2,     4,     6,     4,     6,     3,     1,     3,     6,
  280.      6,     3,     4,     0,     5,     0,     5,     0,     1,     3,
  281.      1,     3,     4,     4,     3,     3,     3,     3,     3,     3,
  282.      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
  283.      3,     3,     3,     1,     1,     1,     1,     1,     1,     1,
  284.      1,     1,     4,     1,     1,     1,     3,     1,     1,     3,
  285.      1,     1
  286. };
  287.  
  288. static const short yydefact[] = {     0,
  289.     66,    67,    64,    65,    68,    69,    74,    81,    76,    82,
  290.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  291.      0,     0,     0,     0,     0,     0,    71,    72,    79,     0,
  292.      5,     0,     9,    10,    38,     2,     1,     0,    28,     0,
  293.     78,    70,     3,     0,    22,     0,     0,     0,     0,     0,
  294.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  295.      0,     7,     0,     0,    39,     0,     0,     0,     0,     0,
  296.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  297.      0,     0,     0,     0,     0,     0,     4,     0,    34,    36,
  298.      8,     0,     0,    38,     0,     0,     0,     0,     0,     0,
  299.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  300.      6,    45,     0,    32,     0,    63,    58,    59,    56,    57,
  301.     53,    54,    55,    38,    29,     0,    62,    60,    61,    46,
  302.     51,    52,    47,    48,    49,    50,    27,     0,    38,    80,
  303.     77,     0,     0,    73,    11,    12,    14,    13,    15,    16,
  304.     17,     0,    19,    20,    21,     0,    23,     0,    25,     0,
  305.      0,    40,    43,    41,     0,     0,    44,    33,     0,     0,
  306.      0,     0,     0,     0,    35,    37,    18,    24,    26,    30,
  307.     31,    42,     0,     0,     0
  308. };
  309.  
  310. static const short yydefgoto[] = {   183,
  311.     36,    65,    63,    38,    39,   138,   139,    66,   165,    40,
  312.     41,    42,    46
  313. };
  314.  
  315. static const short yypact[] = {   159,
  316. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  317.    222,   -54,   -53,   -32,   -24,   -22,   -21,   -20,   -12,     1,
  318.      2,    13,    29,    31,    32,    34,-32768,-32768,-32768,   159,
  319. -32768,   159,-32768,-32768,   159,-32768,   777,   159,-32768,    -5,
  320.     64,-32768,   -23,   159,    28,   -23,   159,   159,   159,   159,
  321.     16,    16,   159,    16,   159,   159,   159,   159,   159,   159,
  322.    159,    28,   159,   307,   777,   -34,   -41,   159,   159,   159,
  323.    159,   159,   159,   159,   159,   -14,   159,   159,   159,   159,
  324.    159,   159,   159,   159,   159,   159,-32768,    88,-32768,-32768,
  325.     28,    -6,   159,   159,    -1,   335,   363,   391,   419,    35,
  326.     38,   447,    61,   475,   503,   531,   251,   279,   727,   753,
  327.     28,-32768,   159,-32768,   159,   801,   -37,   -37,   -37,   -37,
  328.    -37,   -37,   -37,   159,-32768,    33,    69,    87,    87,   144,
  329.    205,   205,    28,    28,    28,    28,-32768,   159,   159,-32768,
  330. -32768,   559,   -33,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  331. -32768,   159,-32768,-32768,-32768,   159,-32768,   159,-32768,   159,
  332.    159,   777,    28,   777,   -36,   -30,-32768,-32768,   587,   615,
  333.    643,   671,   699,   159,-32768,-32768,-32768,-32768,-32768,-32768,
  334. -32768,   777,   107,   108,-32768
  335. };
  336.  
  337. static const short yypgoto[] = {-32768,
  338. -32768,     0,-32768,-32768,    36,-32768,-32768,   -93,-32768,-32768,
  339. -32768,-32768,    52
  340. };
  341.  
  342.  
  343. #define    YYLAST        864
  344.  
  345.  
  346. static const short yytable[] = {    37,
  347.    143,   174,    10,   113,   113,   140,   141,   113,    47,    48,
  348.     45,    77,    78,    79,    80,    81,    82,    83,    84,    85,
  349.     86,    93,    87,    88,    89,    90,    94,   115,    92,    62,
  350.     49,    64,    10,   175,   114,   168,   176,    91,    50,    93,
  351.     51,    52,    53,    64,    94,   166,    96,    97,    98,    99,
  352.     54,    43,   102,   124,   104,   105,   106,   107,   108,   109,
  353.    110,    93,   111,    55,    56,   144,    94,   116,   117,   118,
  354.    119,   120,   121,   122,   123,    57,   127,   128,   129,   130,
  355.    131,   132,   133,   134,   135,   136,    67,    87,    88,    89,
  356.     90,    58,   142,    59,    60,    95,    61,   -75,   152,   137,
  357.     94,   149,   100,   101,   150,   103,   184,   185,     0,     0,
  358.      0,   125,   162,     0,   163,     0,     0,     0,    78,    79,
  359.     80,    81,    82,    83,    84,    85,    86,   126,    87,    88,
  360.     89,    90,     0,     0,     0,     0,     0,   164,    80,    81,
  361.     82,    83,    84,    85,    86,     0,    87,    88,    89,    90,
  362.      0,   169,     0,     0,     0,   170,     0,   171,     0,   172,
  363.    173,     1,     0,     0,     2,     3,     4,     5,     6,     7,
  364.      8,     9,     0,   182,     0,    10,    11,    12,    13,    14,
  365.     15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
  366.     25,    26,     0,    27,    28,    29,    81,    82,    83,    84,
  367.     85,    86,     0,    87,    88,    89,    90,     0,     0,     0,
  368.      0,    30,    31,     0,     0,     0,     0,     0,     0,     0,
  369.      0,    32,    33,    34,     1,     0,    35,     2,     3,     4,
  370.      5,     6,     7,     8,     9,     0,     0,     0,    10,    11,
  371.     12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
  372.     22,    23,    24,    25,    26,     0,    27,    28,    29,    83,
  373.     84,    85,    86,     0,    87,    88,    89,    90,     0,     0,
  374.      0,     0,     0,     0,    30,    31,     0,     0,     0,     0,
  375.      0,     0,     0,     0,    44,    33,    34,     0,   156,    35,
  376.     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  377.     78,    79,    80,    81,    82,    83,    84,    85,    86,     0,
  378.     87,    88,    89,    90,     0,     0,   158,   157,    68,    69,
  379.     70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
  380.     80,    81,    82,    83,    84,    85,    86,     0,    87,    88,
  381.     89,    90,     0,     0,     0,   159,    68,    69,    70,    71,
  382.     72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
  383.     82,    83,    84,    85,    86,     0,    87,    88,    89,    90,
  384.      0,     0,     0,   112,    68,    69,    70,    71,    72,    73,
  385.     74,    75,    76,    77,    78,    79,    80,    81,    82,    83,
  386.     84,    85,    86,     0,    87,    88,    89,    90,     0,     0,
  387.      0,   145,    68,    69,    70,    71,    72,    73,    74,    75,
  388.     76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
  389.     86,     0,    87,    88,    89,    90,     0,     0,     0,   146,
  390.     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  391.     78,    79,    80,    81,    82,    83,    84,    85,    86,     0,
  392.     87,    88,    89,    90,     0,     0,     0,   147,    68,    69,
  393.     70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
  394.     80,    81,    82,    83,    84,    85,    86,     0,    87,    88,
  395.     89,    90,     0,     0,     0,   148,    68,    69,    70,    71,
  396.     72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
  397.     82,    83,    84,    85,    86,     0,    87,    88,    89,    90,
  398.      0,     0,     0,   151,    68,    69,    70,    71,    72,    73,
  399.     74,    75,    76,    77,    78,    79,    80,    81,    82,    83,
  400.     84,    85,    86,     0,    87,    88,    89,    90,     0,     0,
  401.      0,   153,    68,    69,    70,    71,    72,    73,    74,    75,
  402.     76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
  403.     86,     0,    87,    88,    89,    90,     0,     0,     0,   154,
  404.     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  405.     78,    79,    80,    81,    82,    83,    84,    85,    86,     0,
  406.     87,    88,    89,    90,     0,     0,     0,   155,    68,    69,
  407.     70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
  408.     80,    81,    82,    83,    84,    85,    86,     0,    87,    88,
  409.     89,    90,     0,     0,     0,   167,    68,    69,    70,    71,
  410.     72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
  411.     82,    83,    84,    85,    86,     0,    87,    88,    89,    90,
  412.      0,     0,     0,   177,    68,    69,    70,    71,    72,    73,
  413.     74,    75,    76,    77,    78,    79,    80,    81,    82,    83,
  414.     84,    85,    86,     0,    87,    88,    89,    90,     0,     0,
  415.      0,   178,    68,    69,    70,    71,    72,    73,    74,    75,
  416.     76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
  417.     86,     0,    87,    88,    89,    90,     0,     0,     0,   179,
  418.     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  419.     78,    79,    80,    81,    82,    83,    84,    85,    86,     0,
  420.     87,    88,    89,    90,     0,     0,     0,   180,    68,    69,
  421.     70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
  422.     80,    81,    82,    83,    84,    85,    86,     0,    87,    88,
  423.     89,    90,     0,     0,   160,   181,    68,    69,    70,    71,
  424.     72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
  425.     82,    83,    84,    85,    86,     0,    87,    88,    89,    90,
  426.    161,     0,    68,    69,    70,    71,    72,    73,    74,    75,
  427.     76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
  428.     86,     0,    87,    88,    89,    90,    68,    69,    70,    71,
  429.     72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
  430.     82,    83,    84,    85,    86,     0,    87,    88,    89,    90,
  431. -32768,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  432.     78,    79,    80,    81,    82,    83,    84,    85,    86,     0,
  433.     87,    88,    89,    90
  434. };
  435.  
  436. static const short yycheck[] = {     0,
  437.     94,    38,    17,    38,    38,    12,    13,    38,    63,    63,
  438.     11,    49,    50,    51,    52,    53,    54,    55,    56,    57,
  439.     58,    63,    60,    61,    62,    63,    68,    69,    34,    30,
  440.     63,    32,    17,    70,    69,    69,    67,    38,    63,    63,
  441.     63,    63,    63,    44,    68,   139,    47,    48,    49,    50,
  442.     63,     0,    53,    68,    55,    56,    57,    58,    59,    60,
  443.     61,    63,    63,    63,    63,    67,    68,    68,    69,    70,
  444.     71,    72,    73,    74,    75,    63,    77,    78,    79,    80,
  445.     81,    82,    83,    84,    85,    86,    35,    60,    61,    62,
  446.     63,    63,    93,    63,    63,    44,    63,    34,    38,    12,
  447.     68,    67,    51,    52,    67,    54,     0,     0,    -1,    -1,
  448.     -1,    76,   113,    -1,   115,    -1,    -1,    -1,    50,    51,
  449.     52,    53,    54,    55,    56,    57,    58,    76,    60,    61,
  450.     62,    63,    -1,    -1,    -1,    -1,    -1,   138,    52,    53,
  451.     54,    55,    56,    57,    58,    -1,    60,    61,    62,    63,
  452.     -1,   152,    -1,    -1,    -1,   156,    -1,   158,    -1,   160,
  453.    161,     3,    -1,    -1,     6,     7,     8,     9,    10,    11,
  454.     12,    13,    -1,   174,    -1,    17,    18,    19,    20,    21,
  455.     22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
  456.     32,    33,    -1,    35,    36,    37,    53,    54,    55,    56,
  457.     57,    58,    -1,    60,    61,    62,    63,    -1,    -1,    -1,
  458.     -1,    53,    54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  459.     -1,    63,    64,    65,     3,    -1,    68,     6,     7,     8,
  460.      9,    10,    11,    12,    13,    -1,    -1,    -1,    17,    18,
  461.     19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
  462.     29,    30,    31,    32,    33,    -1,    35,    36,    37,    55,
  463.     56,    57,    58,    -1,    60,    61,    62,    63,    -1,    -1,
  464.     -1,    -1,    -1,    -1,    53,    54,    -1,    -1,    -1,    -1,
  465.     -1,    -1,    -1,    -1,    63,    64,    65,    -1,    38,    68,
  466.     40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
  467.     50,    51,    52,    53,    54,    55,    56,    57,    58,    -1,
  468.     60,    61,    62,    63,    -1,    -1,    38,    67,    40,    41,
  469.     42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
  470.     52,    53,    54,    55,    56,    57,    58,    -1,    60,    61,
  471.     62,    63,    -1,    -1,    -1,    67,    40,    41,    42,    43,
  472.     44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
  473.     54,    55,    56,    57,    58,    -1,    60,    61,    62,    63,
  474.     -1,    -1,    -1,    67,    40,    41,    42,    43,    44,    45,
  475.     46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
  476.     56,    57,    58,    -1,    60,    61,    62,    63,    -1,    -1,
  477.     -1,    67,    40,    41,    42,    43,    44,    45,    46,    47,
  478.     48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
  479.     58,    -1,    60,    61,    62,    63,    -1,    -1,    -1,    67,
  480.     40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
  481.     50,    51,    52,    53,    54,    55,    56,    57,    58,    -1,
  482.     60,    61,    62,    63,    -1,    -1,    -1,    67,    40,    41,
  483.     42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
  484.     52,    53,    54,    55,    56,    57,    58,    -1,    60,    61,
  485.     62,    63,    -1,    -1,    -1,    67,    40,    41,    42,    43,
  486.     44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
  487.     54,    55,    56,    57,    58,    -1,    60,    61,    62,    63,
  488.     -1,    -1,    -1,    67,    40,    41,    42,    43,    44,    45,
  489.     46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
  490.     56,    57,    58,    -1,    60,    61,    62,    63,    -1,    -1,
  491.     -1,    67,    40,    41,    42,    43,    44,    45,    46,    47,
  492.     48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
  493.     58,    -1,    60,    61,    62,    63,    -1,    -1,    -1,    67,
  494.     40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
  495.     50,    51,    52,    53,    54,    55,    56,    57,    58,    -1,
  496.     60,    61,    62,    63,    -1,    -1,    -1,    67,    40,    41,
  497.     42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
  498.     52,    53,    54,    55,    56,    57,    58,    -1,    60,    61,
  499.     62,    63,    -1,    -1,    -1,    67,    40,    41,    42,    43,
  500.     44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
  501.     54,    55,    56,    57,    58,    -1,    60,    61,    62,    63,
  502.     -1,    -1,    -1,    67,    40,    41,    42,    43,    44,    45,
  503.     46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
  504.     56,    57,    58,    -1,    60,    61,    62,    63,    -1,    -1,
  505.     -1,    67,    40,    41,    42,    43,    44,    45,    46,    47,
  506.     48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
  507.     58,    -1,    60,    61,    62,    63,    -1,    -1,    -1,    67,
  508.     40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
  509.     50,    51,    52,    53,    54,    55,    56,    57,    58,    -1,
  510.     60,    61,    62,    63,    -1,    -1,    -1,    67,    40,    41,
  511.     42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
  512.     52,    53,    54,    55,    56,    57,    58,    -1,    60,    61,
  513.     62,    63,    -1,    -1,    38,    67,    40,    41,    42,    43,
  514.     44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
  515.     54,    55,    56,    57,    58,    -1,    60,    61,    62,    63,
  516.     38,    -1,    40,    41,    42,    43,    44,    45,    46,    47,
  517.     48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
  518.     58,    -1,    60,    61,    62,    63,    40,    41,    42,    43,
  519.     44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
  520.     54,    55,    56,    57,    58,    -1,    60,    61,    62,    63,
  521.     40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
  522.     50,    51,    52,    53,    54,    55,    56,    57,    58,    -1,
  523.     60,    61,    62,    63
  524. };
  525. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  526. #line 3 "/usr/latest/lib/bison.simple"
  527.  
  528. /* Skeleton output parser for bison,
  529.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  530.  
  531.    This program is free software; you can redistribute it and/or modify
  532.    it under the terms of the GNU General Public License as published by
  533.    the Free Software Foundation; either version 1, or (at your option)
  534.    any later version.
  535.  
  536.    This program is distributed in the hope that it will be useful,
  537.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  538.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  539.    GNU General Public License for more details.
  540.  
  541.    You should have received a copy of the GNU General Public License
  542.    along with this program; if not, write to the Free Software
  543.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  544.  
  545.  
  546. #ifndef alloca
  547. #ifdef __GNUC__
  548. #define alloca __builtin_alloca
  549. #else /* Not GNU C.  */
  550. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
  551. #include <alloca.h>
  552. #else /* Not sparc */
  553. #ifdef MSDOS
  554. #include <malloc.h>
  555. #endif /* MSDOS */
  556. #endif /* Not sparc.  */
  557. #endif /* Not GNU C.  */
  558. #endif /* alloca not defined.  */
  559.  
  560. /* This is the parser code that is written into each bison parser
  561.   when the %semantic_parser declaration is not specified in the grammar.
  562.   It was written by Richard Stallman by simplifying the hairy parser
  563.   used when %semantic_parser is specified.  */
  564.  
  565. /* Note: there must be only one dollar sign in this file.
  566.    It is replaced by the list of actions, each action
  567.    as one case of the switch.  */
  568.  
  569. #define yyerrok        (yyerrstatus = 0)
  570. #define yyclearin    (yychar = YYEMPTY)
  571. #define YYEMPTY        -2
  572. #define YYEOF        0
  573. #define YYACCEPT    return(0)
  574. #define YYABORT     return(1)
  575. #define YYERROR        goto yyerrlab1
  576. /* Like YYERROR except do call yyerror.
  577.    This remains here temporarily to ease the
  578.    transition to the new meaning of YYERROR, for GCC.
  579.    Once GCC version 2 has supplanted version 1, this can go.  */
  580. #define YYFAIL        goto yyerrlab
  581. #define YYRECOVERING()  (!!yyerrstatus)
  582. #define YYBACKUP(token, value) \
  583. do                                \
  584.   if (yychar == YYEMPTY && yylen == 1)                \
  585.     { yychar = (token), yylval = (value);            \
  586.       yychar1 = YYTRANSLATE (yychar);                \
  587.       YYPOPSTACK;                        \
  588.       goto yybackup;                        \
  589.     }                                \
  590.   else                                \
  591.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  592. while (0)
  593.  
  594. #define YYTERROR    1
  595. #define YYERRCODE    256
  596.  
  597. #ifndef YYPURE
  598. #define YYLEX        yylex()
  599. #endif
  600.  
  601. #ifdef YYPURE
  602. #ifdef YYLSP_NEEDED
  603. #define YYLEX        yylex(&yylval, &yylloc)
  604. #else
  605. #define YYLEX        yylex(&yylval)
  606. #endif
  607. #endif
  608.  
  609. /* If nonreentrant, generate the variables here */
  610.  
  611. #ifndef YYPURE
  612.  
  613. int    yychar;            /*  the lookahead symbol        */
  614. YYSTYPE    yylval;            /*  the semantic value of the        */
  615.                 /*  lookahead symbol            */
  616.  
  617. #ifdef YYLSP_NEEDED
  618. YYLTYPE yylloc;            /*  location data for the lookahead    */
  619.                 /*  symbol                */
  620. #endif
  621.  
  622. int yynerrs;            /*  number of parse errors so far       */
  623. #endif  /* not YYPURE */
  624.  
  625. #if YYDEBUG != 0
  626. int yydebug;            /*  nonzero means print parse trace    */
  627. /* Since this is uninitialized, it does not stop multiple parsers
  628.    from coexisting.  */
  629. #endif
  630.  
  631. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  632.  
  633. #ifndef    YYINITDEPTH
  634. #define YYINITDEPTH 200
  635. #endif
  636.  
  637. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  638.     (effective only if the built-in stack extension method is used).  */
  639.  
  640. #if YYMAXDEPTH == 0
  641. #undef YYMAXDEPTH
  642. #endif
  643.  
  644. #ifndef YYMAXDEPTH
  645. #define YYMAXDEPTH 10000
  646. #endif
  647.  
  648. #ifndef __cplusplus
  649.  
  650. /* This is the most reliable way to avoid incompatibilities
  651.    in available built-in functions on various systems.  */
  652. static void
  653. __yy_bcopy (from, to, count)
  654.      char *from;
  655.      char *to;
  656.      int count;
  657. {
  658.   register char *f = from;
  659.   register char *t = to;
  660.   register int i = count;
  661.  
  662.   while (i-- > 0)
  663.     *t++ = *f++;
  664. }
  665.  
  666. #else /* __cplusplus */
  667.  
  668. /* This is the most reliable way to avoid incompatibilities
  669.    in available built-in functions on various systems.  */
  670. static void
  671. __yy_bcopy (char *from, char *to, int count)
  672. {
  673.   register char *f = from;
  674.   register char *t = to;
  675.   register int i = count;
  676.  
  677.   while (i-- > 0)
  678.     *t++ = *f++;
  679. }
  680.  
  681. #endif
  682.  
  683. #line 160 "/usr/latest/lib/bison.simple"
  684. int
  685. yyparse()
  686. {
  687.   register int yystate;
  688.   register int yyn;
  689.   register short *yyssp;
  690.   register YYSTYPE *yyvsp;
  691.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  692.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  693.  
  694.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  695.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  696.  
  697.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  698.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  699.  
  700. #ifdef YYLSP_NEEDED
  701.   YYLTYPE *yyls = yylsa;
  702.   YYLTYPE *yylsp;
  703.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  704.  
  705. #define YYPOPSTACK   (yyvsp--, yysp--, yylsp--)
  706. #else
  707. #define YYPOPSTACK   (yyvsp--, yysp--)
  708. #endif
  709.  
  710.   int yystacksize = YYINITDEPTH;
  711.  
  712. #ifdef YYPURE
  713.   int yychar;
  714.   YYSTYPE yylval;
  715.   int yynerrs;
  716. #ifdef YYLSP_NEEDED
  717.   YYLTYPE yylloc;
  718. #endif
  719. #endif
  720.  
  721.   YYSTYPE yyval;        /*  the variable used to return        */
  722.                 /*  semantic values from the action    */
  723.                 /*  routines                */
  724.  
  725.   int yylen;
  726.  
  727. #if YYDEBUG != 0
  728.   if (yydebug)
  729.     fprintf(stderr, "Starting parse\n");
  730. #endif
  731.  
  732.   yystate = 0;
  733.   yyerrstatus = 0;
  734.   yynerrs = 0;
  735.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  736.  
  737.   /* Initialize stack pointers.
  738.      Waste one element of value and location stack
  739.      so that they stay on the same level as the state stack.  */
  740.  
  741.   yyssp = yyss - 1;
  742.   yyvsp = yyvs;
  743. #ifdef YYLSP_NEEDED
  744.   yylsp = yyls;
  745. #endif
  746.  
  747. /* Push a new state, which is found in  yystate  .  */
  748. /* In all cases, when you get here, the value and location stacks
  749.    have just been pushed. so pushing a state here evens the stacks.  */
  750. yynewstate:
  751.  
  752.   *++yyssp = yystate;
  753.  
  754.   if (yyssp >= yyss + yystacksize - 1)
  755.     {
  756.       /* Give user a chance to reallocate the stack */
  757.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  758.       YYSTYPE *yyvs1 = yyvs;
  759.       short *yyss1 = yyss;
  760. #ifdef YYLSP_NEEDED
  761.       YYLTYPE *yyls1 = yyls;
  762. #endif
  763.  
  764.       /* Get the current used size of the three stacks, in elements.  */
  765.       int size = yyssp - yyss + 1;
  766.  
  767. #ifdef yyoverflow
  768.       /* Each stack pointer address is followed by the size of
  769.      the data in use in that stack, in bytes.  */
  770.       yyoverflow("parser stack overflow",
  771.          &yyss1, size * sizeof (*yyssp),
  772.          &yyvs1, size * sizeof (*yyvsp),
  773. #ifdef YYLSP_NEEDED
  774.          &yyls1, size * sizeof (*yylsp),
  775. #endif
  776.          &yystacksize);
  777.  
  778.       yyss = yyss1; yyvs = yyvs1;
  779. #ifdef YYLSP_NEEDED
  780.       yyls = yyls1;
  781. #endif
  782. #else /* no yyoverflow */
  783.       /* Extend the stack our own way.  */
  784.       if (yystacksize >= YYMAXDEPTH)
  785.     {
  786.       yyerror("parser stack overflow");
  787.       return 2;
  788.     }
  789.       yystacksize *= 2;
  790.       if (yystacksize > YYMAXDEPTH)
  791.     yystacksize = YYMAXDEPTH;
  792.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  793.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  794.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  795.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  796. #ifdef YYLSP_NEEDED
  797.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  798.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  799. #endif
  800. #endif /* no yyoverflow */
  801.  
  802.       yyssp = yyss + size - 1;
  803.       yyvsp = yyvs + size - 1;
  804. #ifdef YYLSP_NEEDED
  805.       yylsp = yyls + size - 1;
  806. #endif
  807.  
  808. #if YYDEBUG != 0
  809.       if (yydebug)
  810.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  811. #endif
  812.  
  813.       if (yyssp >= yyss + yystacksize - 1)
  814.     YYABORT;
  815.     }
  816.  
  817. #if YYDEBUG != 0
  818.   if (yydebug)
  819.     fprintf(stderr, "Entering state %d\n", yystate);
  820. #endif
  821.  
  822.  yybackup:
  823.  
  824. /* Do appropriate processing given the current state.  */
  825. /* Read a lookahead token if we need one and don't already have one.  */
  826. /* yyresume: */
  827.  
  828.   /* First try to decide what to do without reference to lookahead token.  */
  829.  
  830.   yyn = yypact[yystate];
  831.   if (yyn == YYFLAG)
  832.     goto yydefault;
  833.  
  834.   /* Not known => get a lookahead token if don't already have one.  */
  835.  
  836.   /* yychar is either YYEMPTY or YYEOF
  837.      or a valid token in external form.  */
  838.  
  839.   if (yychar == YYEMPTY)
  840.     {
  841. #if YYDEBUG != 0
  842.       if (yydebug)
  843.     fprintf(stderr, "Reading a token: ");
  844. #endif
  845.       yychar = YYLEX;
  846.     }
  847.  
  848.   /* Convert token to internal form (in yychar1) for indexing tables with */
  849.  
  850.   if (yychar <= 0)        /* This means end of input. */
  851.     {
  852.       yychar1 = 0;
  853.       yychar = YYEOF;        /* Don't call YYLEX any more */
  854.  
  855. #if YYDEBUG != 0
  856.       if (yydebug)
  857.     fprintf(stderr, "Now at end of input.\n");
  858. #endif
  859.     }
  860.   else
  861.     {
  862.       yychar1 = YYTRANSLATE(yychar);
  863.  
  864. #if YYDEBUG != 0
  865.       if (yydebug)
  866.     fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
  867. #endif
  868.     }
  869.  
  870.   yyn += yychar1;
  871.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  872.     goto yydefault;
  873.  
  874.   yyn = yytable[yyn];
  875.  
  876.   /* yyn is what to do for this token type in this state.
  877.      Negative => reduce, -yyn is rule number.
  878.      Positive => shift, yyn is new state.
  879.        New state is final state => don't bother to shift,
  880.        just return success.
  881.      0, or most negative number => error.  */
  882.  
  883.   if (yyn < 0)
  884.     {
  885.       if (yyn == YYFLAG)
  886.     goto yyerrlab;
  887.       yyn = -yyn;
  888.       goto yyreduce;
  889.     }
  890.   else if (yyn == 0)
  891.     goto yyerrlab;
  892.  
  893.   if (yyn == YYFINAL)
  894.     YYACCEPT;
  895.  
  896.   /* Shift the lookahead token.  */
  897.  
  898. #if YYDEBUG != 0
  899.   if (yydebug)
  900.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  901. #endif
  902.  
  903.   /* Discard the token being shifted unless it is eof.  */
  904.   if (yychar != YYEOF)
  905.     yychar = YYEMPTY;
  906.  
  907.   *++yyvsp = yylval;
  908. #ifdef YYLSP_NEEDED
  909.   *++yylsp = yylloc;
  910. #endif
  911.  
  912.   /* count tokens shifted since error; after three, turn off error status.  */
  913.   if (yyerrstatus) yyerrstatus--;
  914.  
  915.   yystate = yyn;
  916.   goto yynewstate;
  917.  
  918. /* Do the default action for the current state.  */
  919. yydefault:
  920.  
  921.   yyn = yydefact[yystate];
  922.   if (yyn == 0)
  923.     goto yyerrlab;
  924.  
  925. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  926. yyreduce:
  927.   yylen = yyr2[yyn];
  928.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  929.  
  930. #if YYDEBUG != 0
  931.   if (yydebug)
  932.     {
  933.       int i;
  934.  
  935.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  936.            yyn, yyrline[yyn]);
  937.  
  938.       /* Print the symboles being reduced, and their result.  */
  939.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  940.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  941.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  942.     }
  943. #endif
  944.  
  945.  
  946.   switch (yyn) {
  947.  
  948. case 3:
  949. #line 166 "./m2-exp.y"
  950. { write_exp_elt_opcode(OP_TYPE);
  951.           write_exp_elt_type(yyvsp[0].tval);
  952.           write_exp_elt_opcode(OP_TYPE);
  953.         ;
  954.     break;}
  955. case 4:
  956. #line 175 "./m2-exp.y"
  957. { write_exp_elt_opcode (UNOP_IND); ;
  958.     break;}
  959. case 5:
  960. #line 178 "./m2-exp.y"
  961. { number_sign = -1; ;
  962.     break;}
  963. case 6:
  964. #line 180 "./m2-exp.y"
  965. { number_sign = 1;
  966.               write_exp_elt_opcode (UNOP_NEG); ;
  967.     break;}
  968. case 7:
  969. #line 185 "./m2-exp.y"
  970. { write_exp_elt_opcode(UNOP_PLUS); ;
  971.     break;}
  972. case 8:
  973. #line 189 "./m2-exp.y"
  974. { write_exp_elt_opcode (UNOP_ZEROP); ;
  975.     break;}
  976. case 11:
  977. #line 197 "./m2-exp.y"
  978. { write_exp_elt_opcode (UNOP_CAP); ;
  979.     break;}
  980. case 12:
  981. #line 201 "./m2-exp.y"
  982. { write_exp_elt_opcode (UNOP_ORD); ;
  983.     break;}
  984. case 13:
  985. #line 205 "./m2-exp.y"
  986. { write_exp_elt_opcode (UNOP_ABS); ;
  987.     break;}
  988. case 14:
  989. #line 209 "./m2-exp.y"
  990. { write_exp_elt_opcode (UNOP_HIGH); ;
  991.     break;}
  992. case 15:
  993. #line 213 "./m2-exp.y"
  994. { write_exp_elt_opcode (UNOP_MIN);
  995.               write_exp_elt_type (yyvsp[-1].tval);
  996.               write_exp_elt_opcode (UNOP_MIN); ;
  997.     break;}
  998. case 16:
  999. #line 219 "./m2-exp.y"
  1000. { write_exp_elt_opcode (UNOP_MAX);
  1001.               write_exp_elt_type (yyvsp[-1].tval);
  1002.               write_exp_elt_opcode (UNOP_MIN); ;
  1003.     break;}
  1004. case 17:
  1005. #line 225 "./m2-exp.y"
  1006. { write_exp_elt_opcode (UNOP_FLOAT); ;
  1007.     break;}
  1008. case 18:
  1009. #line 229 "./m2-exp.y"
  1010. { write_exp_elt_opcode (BINOP_VAL);
  1011.               write_exp_elt_type (yyvsp[-3].tval);
  1012.               write_exp_elt_opcode (BINOP_VAL); ;
  1013.     break;}
  1014. case 19:
  1015. #line 235 "./m2-exp.y"
  1016. { write_exp_elt_opcode (UNOP_CHR); ;
  1017.     break;}
  1018. case 20:
  1019. #line 239 "./m2-exp.y"
  1020. { write_exp_elt_opcode (UNOP_ODD); ;
  1021.     break;}
  1022. case 21:
  1023. #line 243 "./m2-exp.y"
  1024. { write_exp_elt_opcode (UNOP_TRUNC); ;
  1025.     break;}
  1026. case 22:
  1027. #line 247 "./m2-exp.y"
  1028. { write_exp_elt_opcode (UNOP_SIZEOF); ;
  1029.     break;}
  1030. case 23:
  1031. #line 252 "./m2-exp.y"
  1032. { write_exp_elt_opcode(UNOP_PREINCREMENT); ;
  1033.     break;}
  1034. case 24:
  1035. #line 256 "./m2-exp.y"
  1036. { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
  1037.               write_exp_elt_opcode(BINOP_ADD);
  1038.               write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); ;
  1039.     break;}
  1040. case 25:
  1041. #line 262 "./m2-exp.y"
  1042. { write_exp_elt_opcode(UNOP_PREDECREMENT);;
  1043.     break;}
  1044. case 26:
  1045. #line 266 "./m2-exp.y"
  1046. { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
  1047.               write_exp_elt_opcode(BINOP_SUB);
  1048.               write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); ;
  1049.     break;}
  1050. case 27:
  1051. #line 272 "./m2-exp.y"
  1052. { write_exp_elt_opcode (STRUCTOP_STRUCT);
  1053.               write_exp_string (yyvsp[0].sval);
  1054.               write_exp_elt_opcode (STRUCTOP_STRUCT); ;
  1055.     break;}
  1056. case 29:
  1057. #line 281 "./m2-exp.y"
  1058. { error("Sets are not implemented.");;
  1059.     break;}
  1060. case 30:
  1061. #line 285 "./m2-exp.y"
  1062. { error("Sets are not implemented.");;
  1063.     break;}
  1064. case 31:
  1065. #line 289 "./m2-exp.y"
  1066. { error("Sets are not implemented.");;
  1067.     break;}
  1068. case 32:
  1069. #line 292 "./m2-exp.y"
  1070. { error("Sets are not implemented.");;
  1071.     break;}
  1072. case 33:
  1073. #line 294 "./m2-exp.y"
  1074. { error("Sets are not implemented.");;
  1075.     break;}
  1076. case 34:
  1077. #line 303 "./m2-exp.y"
  1078. { start_arglist(); ;
  1079.     break;}
  1080. case 35:
  1081. #line 305 "./m2-exp.y"
  1082. { write_exp_elt_opcode (BINOP_MULTI_SUBSCRIPT);
  1083.               write_exp_elt_longcst ((LONGEST) end_arglist());
  1084.               write_exp_elt_opcode (BINOP_MULTI_SUBSCRIPT); ;
  1085.     break;}
  1086. case 36:
  1087. #line 313 "./m2-exp.y"
  1088. { start_arglist (); ;
  1089.     break;}
  1090. case 37:
  1091. #line 315 "./m2-exp.y"
  1092. { write_exp_elt_opcode (OP_FUNCALL);
  1093.               write_exp_elt_longcst ((LONGEST) end_arglist ());
  1094.               write_exp_elt_opcode (OP_FUNCALL); ;
  1095.     break;}
  1096. case 39:
  1097. #line 324 "./m2-exp.y"
  1098. { arglist_len = 1; ;
  1099.     break;}
  1100. case 40:
  1101. #line 328 "./m2-exp.y"
  1102. { arglist_len++; ;
  1103.     break;}
  1104. case 41:
  1105. #line 333 "./m2-exp.y"
  1106. { arglist_len = 1; ;
  1107.     break;}
  1108. case 42:
  1109. #line 338 "./m2-exp.y"
  1110. { arglist_len++; ;
  1111.     break;}
  1112. case 43:
  1113. #line 343 "./m2-exp.y"
  1114. { write_exp_elt_opcode (UNOP_MEMVAL);
  1115.               write_exp_elt_type (yyvsp[-2].tval);
  1116.               write_exp_elt_opcode (UNOP_MEMVAL); ;
  1117.     break;}
  1118. case 44:
  1119. #line 349 "./m2-exp.y"
  1120. { write_exp_elt_opcode (UNOP_CAST);
  1121.               write_exp_elt_type (yyvsp[-3].tval);
  1122.               write_exp_elt_opcode (UNOP_CAST); ;
  1123.     break;}
  1124. case 45:
  1125. #line 355 "./m2-exp.y"
  1126. { ;
  1127.     break;}
  1128. case 46:
  1129. #line 363 "./m2-exp.y"
  1130. { write_exp_elt_opcode (BINOP_REPEAT); ;
  1131.     break;}
  1132. case 47:
  1133. #line 367 "./m2-exp.y"
  1134. { write_exp_elt_opcode (BINOP_MUL); ;
  1135.     break;}
  1136. case 48:
  1137. #line 371 "./m2-exp.y"
  1138. { write_exp_elt_opcode (BINOP_DIV); ;
  1139.     break;}
  1140. case 49:
  1141. #line 375 "./m2-exp.y"
  1142. { write_exp_elt_opcode (BINOP_INTDIV); ;
  1143.     break;}
  1144. case 50:
  1145. #line 379 "./m2-exp.y"
  1146. { write_exp_elt_opcode (BINOP_REM); ;
  1147.     break;}
  1148. case 51:
  1149. #line 383 "./m2-exp.y"
  1150. { write_exp_elt_opcode (BINOP_ADD); ;
  1151.     break;}
  1152. case 52:
  1153. #line 387 "./m2-exp.y"
  1154. { write_exp_elt_opcode (BINOP_SUB); ;
  1155.     break;}
  1156. case 53:
  1157. #line 391 "./m2-exp.y"
  1158. { write_exp_elt_opcode (BINOP_EQUAL); ;
  1159.     break;}
  1160. case 54:
  1161. #line 395 "./m2-exp.y"
  1162. { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
  1163.     break;}
  1164. case 55:
  1165. #line 397 "./m2-exp.y"
  1166. { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
  1167.     break;}
  1168. case 56:
  1169. #line 401 "./m2-exp.y"
  1170. { write_exp_elt_opcode (BINOP_LEQ); ;
  1171.     break;}
  1172. case 57:
  1173. #line 405 "./m2-exp.y"
  1174. { write_exp_elt_opcode (BINOP_GEQ); ;
  1175.     break;}
  1176. case 58:
  1177. #line 409 "./m2-exp.y"
  1178. { write_exp_elt_opcode (BINOP_LESS); ;
  1179.     break;}
  1180. case 59:
  1181. #line 413 "./m2-exp.y"
  1182. { write_exp_elt_opcode (BINOP_GTR); ;
  1183.     break;}
  1184. case 60:
  1185. #line 417 "./m2-exp.y"
  1186. { write_exp_elt_opcode (BINOP_AND); ;
  1187.     break;}
  1188. case 61:
  1189. #line 421 "./m2-exp.y"
  1190. { write_exp_elt_opcode (BINOP_AND); ;
  1191.     break;}
  1192. case 62:
  1193. #line 425 "./m2-exp.y"
  1194. { write_exp_elt_opcode (BINOP_OR); ;
  1195.     break;}
  1196. case 63:
  1197. #line 429 "./m2-exp.y"
  1198. { write_exp_elt_opcode (BINOP_ASSIGN); ;
  1199.     break;}
  1200. case 64:
  1201. #line 436 "./m2-exp.y"
  1202. { write_exp_elt_opcode (OP_BOOL);
  1203.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1204.               write_exp_elt_opcode (OP_BOOL); ;
  1205.     break;}
  1206. case 65:
  1207. #line 442 "./m2-exp.y"
  1208. { write_exp_elt_opcode (OP_BOOL);
  1209.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1210.               write_exp_elt_opcode (OP_BOOL); ;
  1211.     break;}
  1212. case 66:
  1213. #line 448 "./m2-exp.y"
  1214. { write_exp_elt_opcode (OP_LONG);
  1215.               write_exp_elt_type (builtin_type_m2_int);
  1216.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1217.               write_exp_elt_opcode (OP_LONG); ;
  1218.     break;}
  1219. case 67:
  1220. #line 455 "./m2-exp.y"
  1221. {
  1222.               write_exp_elt_opcode (OP_LONG);
  1223.               write_exp_elt_type (builtin_type_m2_card);
  1224.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1225.               write_exp_elt_opcode (OP_LONG);
  1226.             ;
  1227.     break;}
  1228. case 68:
  1229. #line 464 "./m2-exp.y"
  1230. { write_exp_elt_opcode (OP_LONG);
  1231.               write_exp_elt_type (builtin_type_m2_char);
  1232.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1233.               write_exp_elt_opcode (OP_LONG); ;
  1234.     break;}
  1235. case 69:
  1236. #line 472 "./m2-exp.y"
  1237. { write_exp_elt_opcode (OP_DOUBLE);
  1238.               write_exp_elt_type (builtin_type_m2_real);
  1239.               write_exp_elt_dblcst (yyvsp[0].dval);
  1240.               write_exp_elt_opcode (OP_DOUBLE); ;
  1241.     break;}
  1242. case 71:
  1243. #line 483 "./m2-exp.y"
  1244. { write_exp_elt_opcode (OP_LAST);
  1245.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1246.               write_exp_elt_opcode (OP_LAST); ;
  1247.     break;}
  1248. case 72:
  1249. #line 489 "./m2-exp.y"
  1250. { write_exp_elt_opcode (OP_REGISTER);
  1251.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1252.               write_exp_elt_opcode (OP_REGISTER); ;
  1253.     break;}
  1254. case 73:
  1255. #line 495 "./m2-exp.y"
  1256. { write_exp_elt_opcode (OP_LONG);
  1257.               write_exp_elt_type (builtin_type_int);
  1258.               write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
  1259.               write_exp_elt_opcode (OP_LONG); ;
  1260.     break;}
  1261. case 74:
  1262. #line 502 "./m2-exp.y"
  1263. { write_exp_elt_opcode (OP_M2_STRING);
  1264.               write_exp_string (yyvsp[0].sval);
  1265.               write_exp_elt_opcode (OP_M2_STRING); ;
  1266.     break;}
  1267. case 75:
  1268. #line 509 "./m2-exp.y"
  1269. { yyval.bval = SYMBOL_BLOCK_VALUE(yyvsp[0].sym); ;
  1270.     break;}
  1271. case 76:
  1272. #line 513 "./m2-exp.y"
  1273. { struct symbol *sym
  1274.                 = lookup_symbol (copy_name (yyvsp[0].sval), expression_context_block,
  1275.                          VAR_NAMESPACE, 0, NULL);
  1276.               yyval.sym = sym;;
  1277.     break;}
  1278. case 77:
  1279. #line 522 "./m2-exp.y"
  1280. { struct symbol *tem
  1281.                 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
  1282.                          VAR_NAMESPACE, 0, NULL);
  1283.               if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
  1284.                 error ("No function \"%s\" in specified context.",
  1285.                    copy_name (yyvsp[0].sval));
  1286.               yyval.sym = tem;
  1287.             ;
  1288.     break;}
  1289. case 78:
  1290. #line 534 "./m2-exp.y"
  1291. { write_exp_elt_opcode(OP_VAR_VALUE);
  1292.               write_exp_elt_sym (yyvsp[0].sym);
  1293.               write_exp_elt_opcode (OP_VAR_VALUE); ;
  1294.     break;}
  1295. case 79:
  1296. #line 541 "./m2-exp.y"
  1297. { write_exp_elt_opcode (OP_INTERNALVAR);
  1298.               write_exp_elt_intern (yyvsp[0].ivar);
  1299.               write_exp_elt_opcode (OP_INTERNALVAR); ;
  1300.     break;}
  1301. case 80:
  1302. #line 548 "./m2-exp.y"
  1303. { struct symbol *sym;
  1304.               sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
  1305.                            VAR_NAMESPACE, 0, NULL);
  1306.               if (sym == 0)
  1307.                 error ("No symbol \"%s\" in specified context.",
  1308.                    copy_name (yyvsp[0].sval));
  1309.  
  1310.               write_exp_elt_opcode (OP_VAR_VALUE);
  1311.               write_exp_elt_sym (sym);
  1312.               write_exp_elt_opcode (OP_VAR_VALUE); ;
  1313.     break;}
  1314. case 81:
  1315. #line 562 "./m2-exp.y"
  1316. { struct symbol *sym;
  1317.               int is_a_field_of_this;
  1318.  
  1319.                sym = lookup_symbol (copy_name (yyvsp[0].sval),
  1320.                            expression_context_block,
  1321.                            VAR_NAMESPACE,
  1322.                            &is_a_field_of_this,
  1323.                            NULL);
  1324.               if (sym)
  1325.                 {
  1326.                   switch (sym->class)
  1327.                 {
  1328.                 case LOC_REGISTER:
  1329.                 case LOC_ARG:
  1330.                 case LOC_LOCAL:
  1331.                   if (innermost_block == 0 ||
  1332.                       contained_in (block_found,
  1333.                             innermost_block))
  1334.                     innermost_block = block_found;
  1335.                 }
  1336.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1337.                   write_exp_elt_sym (sym);
  1338.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1339.                 }
  1340.               else
  1341.                 {
  1342.                   register int i;
  1343.                   register char *arg = copy_name (yyvsp[0].sval);
  1344.  
  1345.                   for (i = 0; i < misc_function_count; i++)
  1346.                 if (!strcmp (misc_function_vector[i].name, arg))
  1347.                   break;
  1348.  
  1349.                   if (i < misc_function_count)
  1350.                 {
  1351.                   enum misc_function_type mft =
  1352.                     (enum misc_function_type)
  1353.                       misc_function_vector[i].type;
  1354.  
  1355.                   write_exp_elt_opcode (OP_LONG);
  1356.                   write_exp_elt_type (builtin_type_int);
  1357.                   write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address);
  1358.                   write_exp_elt_opcode (OP_LONG);
  1359.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1360.                   if (mft == mf_data || mft == mf_bss)
  1361.                     write_exp_elt_type (builtin_type_int);
  1362.                   else if (mft == mf_text)
  1363.                     write_exp_elt_type (lookup_function_type (builtin_type_int));
  1364.                   else
  1365.                     write_exp_elt_type (builtin_type_char);
  1366.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1367.                 }
  1368.                   else if (symtab_list == 0
  1369.                        && partial_symtab_list == 0)
  1370.                 error ("No symbol table is loaded.  Use the \"symbol-file\" command.");
  1371.                   else
  1372.                 error ("No symbol \"%s\" in current context.",
  1373.                        copy_name (yyvsp[0].sval));
  1374.                 }
  1375.             ;
  1376.     break;}
  1377. case 82:
  1378. #line 626 "./m2-exp.y"
  1379. { yyval.tval = lookup_typename (copy_name (yyvsp[0].sval),
  1380.                         expression_context_block, 0); ;
  1381.     break;}
  1382. }
  1383.    /* the action file gets copied in in place of this dollarsign */
  1384. #line 423 "/usr/latest/lib/bison.simple"
  1385.  
  1386.   yyvsp -= yylen;
  1387.   yyssp -= yylen;
  1388. #ifdef YYLSP_NEEDED
  1389.   yylsp -= yylen;
  1390. #endif
  1391.  
  1392. #if YYDEBUG != 0
  1393.   if (yydebug)
  1394.     {
  1395.       short *ssp1 = yyss - 1;
  1396.       fprintf (stderr, "state stack now");
  1397.       while (ssp1 != yyssp)
  1398.     fprintf (stderr, " %d", *++ssp1);
  1399.       fprintf (stderr, "\n");
  1400.     }
  1401. #endif
  1402.  
  1403.   *++yyvsp = yyval;
  1404.  
  1405. #ifdef YYLSP_NEEDED
  1406.   yylsp++;
  1407.   if (yylen == 0)
  1408.     {
  1409.       yylsp->first_line = yylloc.first_line;
  1410.       yylsp->first_column = yylloc.first_column;
  1411.       yylsp->last_line = (yylsp-1)->last_line;
  1412.       yylsp->last_column = (yylsp-1)->last_column;
  1413.       yylsp->text = 0;
  1414.     }
  1415.   else
  1416.     {
  1417.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1418.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1419.     }
  1420. #endif
  1421.  
  1422.   /* Now "shift" the result of the reduction.
  1423.      Determine what state that goes to,
  1424.      based on the state we popped back to
  1425.      and the rule number reduced by.  */
  1426.  
  1427.   yyn = yyr1[yyn];
  1428.  
  1429.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1430.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1431.     yystate = yytable[yystate];
  1432.   else
  1433.     yystate = yydefgoto[yyn - YYNTBASE];
  1434.  
  1435.   goto yynewstate;
  1436.  
  1437. yyerrlab:   /* here on detecting error */
  1438.  
  1439.   if (! yyerrstatus)
  1440.     /* If not already recovering from an error, report this error.  */
  1441.     {
  1442.       ++yynerrs;
  1443.  
  1444. #ifdef YYERROR_VERBOSE
  1445.       yyn = yypact[yystate];
  1446.  
  1447.       if (yyn > YYFLAG && yyn < YYLAST)
  1448.     {
  1449.       int size = 0;
  1450.       char *msg;
  1451.       int x, count;
  1452.  
  1453.       count = 0;
  1454.       for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  1455.         if (yycheck[x + yyn] == x)
  1456.           size += strlen(yytname[x]) + 15, count++;
  1457.       msg = (char *) xmalloc(size + 15);
  1458.       strcpy(msg, "parse error");
  1459.  
  1460.       if (count < 5)
  1461.         {
  1462.           count = 0;
  1463.           for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  1464.         if (yycheck[x + yyn] == x)
  1465.           {
  1466.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1467.             strcat(msg, yytname[x]);
  1468.             strcat(msg, "'");
  1469.             count++;
  1470.           }
  1471.         }
  1472.       yyerror(msg);
  1473.       free(msg);
  1474.     }
  1475.       else
  1476. #endif /* YYERROR_VERBOSE */
  1477.     yyerror("parse error");
  1478.     }
  1479.  
  1480. yyerrlab1:   /* here on error raised explicitly by an action */
  1481.  
  1482.   if (yyerrstatus == 3)
  1483.     {
  1484.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1485.  
  1486.       /* return failure if at end of input */
  1487.       if (yychar == YYEOF)
  1488.     YYABORT;
  1489.  
  1490. #if YYDEBUG != 0
  1491.       if (yydebug)
  1492.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1493. #endif
  1494.  
  1495.       yychar = YYEMPTY;
  1496.     }
  1497.  
  1498.   /* Else will try to reuse lookahead token
  1499.      after shifting the error token.  */
  1500.  
  1501.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1502.  
  1503.   goto yyerrhandle;
  1504.  
  1505. yyerrdefault:  /* current state does not do anything special for the error token. */
  1506.  
  1507. #if 0
  1508.   /* This is wrong; only states that explicitly want error tokens
  1509.      should shift them.  */
  1510.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1511.   if (yyn) goto yydefault;
  1512. #endif
  1513.  
  1514. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1515.  
  1516.   if (yyssp == yyss) YYABORT;
  1517.   yyvsp--;
  1518.   yystate = *--yyssp;
  1519. #ifdef YYLSP_NEEDED
  1520.   yylsp--;
  1521. #endif
  1522.  
  1523. #if YYDEBUG != 0
  1524.   if (yydebug)
  1525.     {
  1526.       short *ssp1 = yyss - 1;
  1527.       fprintf (stderr, "Error: state stack now");
  1528.       while (ssp1 != yyssp)
  1529.     fprintf (stderr, " %d", *++ssp1);
  1530.       fprintf (stderr, "\n");
  1531.     }
  1532. #endif
  1533.  
  1534. yyerrhandle:
  1535.  
  1536.   yyn = yypact[yystate];
  1537.   if (yyn == YYFLAG)
  1538.     goto yyerrdefault;
  1539.  
  1540.   yyn += YYTERROR;
  1541.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1542.     goto yyerrdefault;
  1543.  
  1544.   yyn = yytable[yyn];
  1545.   if (yyn < 0)
  1546.     {
  1547.       if (yyn == YYFLAG)
  1548.     goto yyerrpop;
  1549.       yyn = -yyn;
  1550.       goto yyreduce;
  1551.     }
  1552.   else if (yyn == 0)
  1553.     goto yyerrpop;
  1554.  
  1555.   if (yyn == YYFINAL)
  1556.     YYACCEPT;
  1557.  
  1558. #if YYDEBUG != 0
  1559.   if (yydebug)
  1560.     fprintf(stderr, "Shifting error token, ");
  1561. #endif
  1562.  
  1563.   *++yyvsp = yylval;
  1564. #ifdef YYLSP_NEEDED
  1565.   *++yylsp = yylloc;
  1566. #endif
  1567.  
  1568.   yystate = yyn;
  1569.   goto yynewstate;
  1570. }
  1571. #line 631 "./m2-exp.y"
  1572.  
  1573.  
  1574. #if 0  /* FIXME! */
  1575. int
  1576. overflow(a,b)
  1577.    long a,b;
  1578. {
  1579.    return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
  1580. }
  1581.  
  1582. int
  1583. uoverflow(a,b)
  1584.    unsigned long a,b;
  1585. {
  1586.    return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
  1587. }
  1588. #endif /* FIXME */
  1589.  
  1590. /* Take care of parsing a number (anything that starts with a digit).
  1591.    Set yylval and return the token type; update lexptr.
  1592.    LEN is the number of characters in it.  */
  1593.  
  1594. /*** Needs some error checking for the float case ***/
  1595.  
  1596. static int
  1597. parse_number (olen)
  1598.      int olen;
  1599. {
  1600.   register char *p = lexptr;
  1601.   register LONGEST n = 0;
  1602.   register LONGEST prevn = 0;
  1603.   register int c,i,ischar=0;
  1604.   register int base = input_radix;
  1605.   register int len = olen;
  1606.   int unsigned_p = number_sign == 1 ? 1 : 0;
  1607.  
  1608.   extern double atof ();
  1609.  
  1610.   if(p[len-1] == 'H')
  1611.   {
  1612.      base = 16;
  1613.      len--;
  1614.   }
  1615.   else if(p[len-1] == 'C' || p[len-1] == 'B')
  1616.   {
  1617.      base = 8;
  1618.      ischar = p[len-1] == 'C';
  1619.      len--;
  1620.   }
  1621.  
  1622.   /* Scan the number */
  1623.   for (c = 0; c < len; c++)
  1624.   {
  1625.     if (p[c] == '.' && base == 10)
  1626.       {
  1627.     /* It's a float since it contains a point.  */
  1628.     yylval.dval = atof (p);
  1629.     lexptr += len;
  1630.     return FLOAT;
  1631.       }
  1632.     if (p[c] == '.' && base != 10)
  1633.        error("Floating point numbers must be base 10.");
  1634.     if (base == 10 && (p[c] < '0' || p[c] > '9'))
  1635.        error("Invalid digit \'%c\' in number.",p[c]);
  1636.  }
  1637.  
  1638.   while (len-- > 0)
  1639.     {
  1640.       c = *p++;
  1641.       n *= base;
  1642.       if( base == 8 && (c == '8' || c == '9'))
  1643.      error("Invalid digit \'%c\' in octal number.",c);
  1644.       if (c >= '0' && c <= '9')
  1645.     i = c - '0';
  1646.       else
  1647.     {
  1648.       if (base == 16 && c >= 'A' && c <= 'F')
  1649.         i = c - 'A' + 10;
  1650.       else
  1651.          return ERROR;
  1652.     }
  1653.       n+=i;
  1654.       if(i >= base)
  1655.      return ERROR;
  1656.       if(!unsigned_p && number_sign == 1 && (prevn >= n))
  1657.      unsigned_p=1;        /* Try something unsigned */
  1658.       /* Don't do the range check if n==i and i==0, since that special
  1659.      case will give an overflow error. */
  1660.       if(RANGE_CHECK && n!=i && i)
  1661.       {
  1662.      if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
  1663.         ((!unsigned_p && number_sign==-1) && -prevn <= -n))
  1664.         range_error("Overflow on numeric constant.");
  1665.       }
  1666.      prevn=n;
  1667.     }
  1668.  
  1669.   lexptr = p;
  1670.   if(*p == 'B' || *p == 'C' || *p == 'H')
  1671.      lexptr++;            /* Advance past B,C or H */
  1672.  
  1673.   if (ischar)
  1674.   {
  1675.      yylval.ulval = n;
  1676.      return CHAR;
  1677.   }
  1678.   else if ( unsigned_p && number_sign == 1)
  1679.   {
  1680.      yylval.ulval = n;
  1681.      return UINT;
  1682.   }
  1683.   else if((unsigned_p && (n<0))) {
  1684.      range_error("Overflow on numeric constant -- number too large.");
  1685.      /* But, this can return if range_check == range_warn.  */
  1686.   }
  1687.   yylval.lval = n;
  1688.   return INT;
  1689. }
  1690.  
  1691.  
  1692. /* Some tokens */
  1693.  
  1694. static struct
  1695. {
  1696.    char name[2];
  1697.    int token;
  1698. } tokentab2[] =
  1699. {
  1700.     {"<>",    NOTEQUAL      },
  1701.     {":=",    ASSIGN     },
  1702.     {"<=",    LEQ     },
  1703.     {">=",    GEQ     },
  1704.     {"::",    COLONCOLON },
  1705.  
  1706. };
  1707.  
  1708. /* Some specific keywords */
  1709.  
  1710. struct keyword {
  1711.    char keyw[10];
  1712.    int token;
  1713. };
  1714.  
  1715. static struct keyword keytab[] =
  1716. {
  1717.     {"OR" ,   OR     },
  1718.     {"IN",    IN         },/* Note space after IN */
  1719.     {"AND",   AND        },
  1720.     {"ABS",   ABS     },
  1721.     {"CHR",   CHR     },
  1722.     {"DEC",   DEC     },
  1723.     {"NOT",   NOT     },
  1724.     {"DIV",   DIV         },
  1725.     {"INC",   INC     },
  1726.     {"MAX",   MAX     },
  1727.     {"MIN",   MIN     },
  1728.     {"MOD",   MOD     },
  1729.     {"ODD",   ODD     },
  1730.     {"CAP",   CAP     },
  1731.     {"ORD",   ORD     },
  1732.     {"VAL",   VAL     },
  1733.     {"EXCL",  EXCL     },
  1734.     {"HIGH",  HIGH       },
  1735.     {"INCL",  INCL     },
  1736.     {"SIZE",  SIZE       },
  1737.     {"FLOAT", FLOAT_FUNC },
  1738.     {"TRUNC", TRUNC     },
  1739. };
  1740.  
  1741.  
  1742. /* Read one token, getting characters through lexptr.  */
  1743.  
  1744. /* This is where we will check to make sure that the language and the operators used are
  1745.    compatible  */
  1746.  
  1747. static int
  1748. yylex ()
  1749. {
  1750.   register int c;
  1751.   register int namelen;
  1752.   register int i;
  1753.   register char *tokstart;
  1754.   register char quote;
  1755.  
  1756.  retry:
  1757.  
  1758.   tokstart = lexptr;
  1759.  
  1760.  
  1761.   /* See if it is a special token of length 2 */
  1762.   for( i = 0 ; i < sizeof tokentab2 / sizeof tokentab2[0] ; i++)
  1763.      if(!strncmp(tokentab2[i].name, tokstart, 2))
  1764.      {
  1765.     lexptr += 2;
  1766.     return tokentab2[i].token;
  1767.      }
  1768.  
  1769.   switch (c = *tokstart)
  1770.     {
  1771.     case 0:
  1772.       return 0;
  1773.  
  1774.     case ' ':
  1775.     case '\t':
  1776.     case '\n':
  1777.       lexptr++;
  1778.       goto retry;
  1779.  
  1780.     case '(':
  1781.       paren_depth++;
  1782.       lexptr++;
  1783.       return c;
  1784.  
  1785.     case ')':
  1786.       if (paren_depth == 0)
  1787.     return 0;
  1788.       paren_depth--;
  1789.       lexptr++;
  1790.       return c;
  1791.  
  1792.     case ',':
  1793.       if (comma_terminates && paren_depth == 0)
  1794.     return 0;
  1795.       lexptr++;
  1796.       return c;
  1797.  
  1798.     case '.':
  1799.       /* Might be a floating point number.  */
  1800.       if (lexptr[1] >= '0' && lexptr[1] <= '9')
  1801.     break;            /* Falls into number code.  */
  1802.       else
  1803.       {
  1804.      lexptr++;
  1805.      return DOT;
  1806.       }
  1807.  
  1808. /* These are character tokens that appear as-is in the YACC grammar */
  1809.     case '+':
  1810.     case '-':
  1811.     case '*':
  1812.     case '/':
  1813.     case '^':
  1814.     case '<':
  1815.     case '>':
  1816.     case '[':
  1817.     case ']':
  1818.     case '=':
  1819.     case '{':
  1820.     case '}':
  1821.     case '#':
  1822.     case '@':
  1823.     case '~':
  1824.     case '&':
  1825.       lexptr++;
  1826.       return c;
  1827.  
  1828.     case '\'' :
  1829.     case '"':
  1830.       quote = c;
  1831.       for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
  1832.     if (c == '\\')
  1833.       {
  1834.         c = tokstart[++namelen];
  1835.         if (c >= '0' && c <= '9')
  1836.           {
  1837.         c = tokstart[++namelen];
  1838.         if (c >= '0' && c <= '9')
  1839.           c = tokstart[++namelen];
  1840.           }
  1841.       }
  1842.       if(c != quote)
  1843.      error("Unterminated string or character constant.");
  1844.       yylval.sval.ptr = tokstart + 1;
  1845.       yylval.sval.length = namelen - 1;
  1846.       lexptr += namelen + 1;
  1847.  
  1848.       if(namelen == 2)      /* Single character */
  1849.       {
  1850.        yylval.ulval = tokstart[1];
  1851.        return CHAR;
  1852.       }
  1853.       else
  1854.      return STRING;
  1855.     }
  1856.  
  1857.   /* Is it a number?  */
  1858.   /* Note:  We have already dealt with the case of the token '.'.
  1859.      See case '.' above.  */
  1860.   if ((c >= '0' && c <= '9'))
  1861.     {
  1862.       /* It's a number.  */
  1863.       int got_dot = 0, got_e = 0;
  1864.       register char *p = tokstart;
  1865.       int toktype;
  1866.  
  1867.       for (++p ;; ++p)
  1868.     {
  1869.       if (!got_e && (*p == 'e' || *p == 'E'))
  1870.         got_dot = got_e = 1;
  1871.       else if (!got_dot && *p == '.')
  1872.         got_dot = 1;
  1873.       else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
  1874.            && (*p == '-' || *p == '+'))
  1875.         /* This is the sign of the exponent, not the end of the
  1876.            number.  */
  1877.         continue;
  1878.       else if ((*p < '0' || *p > '9') &&
  1879.            (*p < 'A' || *p > 'F') &&
  1880.            (*p != 'H'))  /* Modula-2 hexadecimal number */
  1881.         break;
  1882.     }
  1883.     toktype = parse_number (p - tokstart);
  1884.         if (toktype == ERROR)
  1885.       {
  1886.         char *err_copy = (char *) alloca (p - tokstart + 1);
  1887.  
  1888.         bcopy (tokstart, err_copy, p - tokstart);
  1889.         err_copy[p - tokstart] = 0;
  1890.         error ("Invalid number \"%s\".", err_copy);
  1891.       }
  1892.     lexptr = p;
  1893.     return toktype;
  1894.     }
  1895.  
  1896.   if (!(c == '_' || c == '$'
  1897.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
  1898.     /* We must have come across a bad character (e.g. ';').  */
  1899.     error ("Invalid character '%c' in expression.", c);
  1900.  
  1901.   /* It's a name.  See how long it is.  */
  1902.   namelen = 0;
  1903.   for (c = tokstart[namelen];
  1904.        (c == '_' || c == '$' || (c >= '0' && c <= '9')
  1905.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
  1906.        c = tokstart[++namelen])
  1907.     ;
  1908.  
  1909.   /* The token "if" terminates the expression and is NOT
  1910.      removed from the input stream.  */
  1911.   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
  1912.     {
  1913.       return 0;
  1914.     }
  1915.  
  1916.   lexptr += namelen;
  1917.  
  1918.   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
  1919.      and $$digits (equivalent to $<-digits> if you could type that).
  1920.      Make token type LAST, and put the number (the digits) in yylval.  */
  1921.  
  1922.   if (*tokstart == '$')
  1923.     {
  1924.       register int negate = 0;
  1925.       c = 1;
  1926.       /* Double dollar means negate the number and add -1 as well.
  1927.      Thus $$ alone means -1.  */
  1928.       if (namelen >= 2 && tokstart[1] == '$')
  1929.     {
  1930.       negate = 1;
  1931.       c = 2;
  1932.     }
  1933.       if (c == namelen)
  1934.     {
  1935.       /* Just dollars (one or two) */
  1936.       yylval.lval = - negate;
  1937.       return LAST;
  1938.     }
  1939.       /* Is the rest of the token digits?  */
  1940.       for (; c < namelen; c++)
  1941.     if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
  1942.       break;
  1943.       if (c == namelen)
  1944.     {
  1945.       yylval.lval = atoi (tokstart + 1 + negate);
  1946.       if (negate)
  1947.         yylval.lval = - yylval.lval;
  1948.       return LAST;
  1949.     }
  1950.     }
  1951.  
  1952.   /* Handle tokens that refer to machine registers:
  1953.      $ followed by a register name.  */
  1954.  
  1955.   if (*tokstart == '$') {
  1956.     for (c = 0; c < NUM_REGS; c++)
  1957.       if (namelen - 1 == strlen (reg_names[c])
  1958.       && !strncmp (tokstart + 1, reg_names[c], namelen - 1))
  1959.     {
  1960.       yylval.lval = c;
  1961.       return REGNAME;
  1962.     }
  1963.     for (c = 0; c < num_std_regs; c++)
  1964.      if (namelen - 1 == strlen (std_regs[c].name)
  1965.      && !strncmp (tokstart + 1, std_regs[c].name, namelen - 1))
  1966.        {
  1967.      yylval.lval = std_regs[c].regnum;
  1968.      return REGNAME;
  1969.        }
  1970.   }
  1971.  
  1972.  
  1973.   /*  Lookup special keywords */
  1974.   for(i = 0 ; i < sizeof(keytab) / sizeof(keytab[0]) ; i++)
  1975.      if(namelen == strlen(keytab[i].keyw) && !strncmp(tokstart,keytab[i].keyw,namelen))
  1976.        return keytab[i].token;
  1977.  
  1978.   yylval.sval.ptr = tokstart;
  1979.   yylval.sval.length = namelen;
  1980.  
  1981.   /* Any other names starting in $ are debugger internal variables.  */
  1982.  
  1983.   if (*tokstart == '$')
  1984.     {
  1985.       yylval.ivar = (struct internalvar *) lookup_internalvar (copy_name (yylval.sval) + 1);
  1986.       return INTERNAL_VAR;
  1987.     }
  1988.  
  1989.  
  1990.   /* Use token-type BLOCKNAME for symbols that happen to be defined as
  1991.      functions.  If this is not so, then ...
  1992.      Use token-type TYPENAME for symbols that happen to be defined
  1993.      currently as names of types; NAME for other symbols.
  1994.      The caller is not constrained to care about the distinction.  */
  1995.  {
  1996.  
  1997.  
  1998.     char *tmp = copy_name (yylval.sval);
  1999.     struct symbol *sym;
  2000.  
  2001.     if (lookup_partial_symtab (tmp))
  2002.       return BLOCKNAME;
  2003.     sym = lookup_symbol (tmp, expression_context_block,
  2004.              VAR_NAMESPACE, 0, NULL);
  2005.     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
  2006.       return BLOCKNAME;
  2007.     if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
  2008.       return TYPENAME;
  2009.  
  2010.     if(sym)
  2011.     {
  2012.        switch(sym->class)
  2013.        {
  2014.        case LOC_STATIC:
  2015.        case LOC_REGISTER:
  2016.        case LOC_ARG:
  2017.        case LOC_REF_ARG:
  2018.        case LOC_REGPARM:
  2019.        case LOC_LOCAL:
  2020.        case LOC_LOCAL_ARG:
  2021.        case LOC_CONST:
  2022.        case LOC_CONST_BYTES:
  2023.       return NAME;
  2024.  
  2025.        case LOC_TYPEDEF:
  2026.       return TYPENAME;
  2027.  
  2028.        case LOC_BLOCK:
  2029.       return BLOCKNAME;
  2030.  
  2031.        case LOC_UNDEF:
  2032.       error("internal:  Undefined class in m2lex()");
  2033.  
  2034.        case LOC_LABEL:
  2035.       error("internal:  Unforseen case in m2lex()");
  2036.        }
  2037.     }
  2038.     else
  2039.     {
  2040.        /* Built-in BOOLEAN type.  This is sort of a hack. */
  2041.        if(!strncmp(tokstart,"TRUE",4))
  2042.        {
  2043.       yylval.ulval = 1;
  2044.       return TRUE;
  2045.        }
  2046.        else if(!strncmp(tokstart,"FALSE",5))
  2047.        {
  2048.       yylval.ulval = 0;
  2049.       return FALSE;
  2050.        }
  2051.     }
  2052.  
  2053.     /* Must be another type of name... */
  2054.     return NAME;
  2055.  }
  2056. }
  2057.  
  2058. char *
  2059. make_qualname(mod,ident)
  2060.    char *mod, *ident;
  2061. {
  2062.    char *new = xmalloc(strlen(mod)+strlen(ident)+2);
  2063.  
  2064.    strcpy(new,mod);
  2065.    strcat(new,".");
  2066.    strcat(new,ident);
  2067.    return new;
  2068. }
  2069.  
  2070.  
  2071. void
  2072. yyerror()
  2073. {
  2074.    printf("Parsing:  %s\n",lexptr);
  2075.    if (yychar < 256)
  2076.      error("Invalid syntax in expression near character '%c'.",yychar);
  2077.    else
  2078.      error("Invalid syntax in expression");
  2079. }
  2080.  
  2081. /* Table of operators and their precedences for printing expressions.  */
  2082.  
  2083. const static struct op_print m2_op_print_tab[] = {
  2084.     {"+",   BINOP_ADD, PREC_ADD, 0},
  2085.     {"+",   UNOP_PLUS, PREC_PREFIX, 0},
  2086.     {"-",   BINOP_SUB, PREC_ADD, 0},
  2087.     {"-",   UNOP_NEG, PREC_PREFIX, 0},
  2088.     {"*",   BINOP_MUL, PREC_MUL, 0},
  2089.     {"/",   BINOP_DIV, PREC_MUL, 0},
  2090.     {"DIV", BINOP_INTDIV, PREC_MUL, 0},
  2091.     {"MOD", BINOP_REM, PREC_MUL, 0},
  2092.     {":=",  BINOP_ASSIGN, PREC_ASSIGN, 1},
  2093.     {"OR",  BINOP_OR, PREC_OR, 0},
  2094.     {"AND", BINOP_AND, PREC_AND, 0},
  2095.     {"NOT", UNOP_ZEROP, PREC_PREFIX, 0},
  2096.     {"=",   BINOP_EQUAL, PREC_EQUAL, 0},
  2097.     {"<>",  BINOP_NOTEQUAL, PREC_EQUAL, 0},
  2098.     {"<=",  BINOP_LEQ, PREC_ORDER, 0},
  2099.     {">=",  BINOP_GEQ, PREC_ORDER, 0},
  2100.     {">",   BINOP_GTR, PREC_ORDER, 0},
  2101.     {"<",   BINOP_LESS, PREC_ORDER, 0},
  2102.     {"^",   UNOP_IND, PREC_PREFIX, 0},
  2103.     {"@",   BINOP_REPEAT, PREC_REPEAT, 0},
  2104. };
  2105.  
  2106. /* The built-in types of Modula-2.  */
  2107.  
  2108. struct type *builtin_type_m2_char;
  2109. struct type *builtin_type_m2_int;
  2110. struct type *builtin_type_m2_card;
  2111. struct type *builtin_type_m2_real;
  2112. struct type *builtin_type_m2_bool;
  2113.  
  2114. struct type ** const (m2_builtin_types[]) = 
  2115. {
  2116.   &builtin_type_m2_char,
  2117.   &builtin_type_m2_int,
  2118.   &builtin_type_m2_card,
  2119.   &builtin_type_m2_real,
  2120.   &builtin_type_m2_bool,
  2121.   0
  2122. };
  2123.  
  2124. const struct language_defn m2_language_defn = {
  2125.   "modula-2",
  2126.   language_m2,
  2127.   m2_builtin_types,
  2128.   range_check_on,
  2129.   type_check_on,
  2130.   m2_parse,            /* parser */
  2131.   m2_error,            /* parser error function */
  2132.   &builtin_type_m2_int,        /* longest signed   integral type */
  2133.   &builtin_type_m2_card,        /* longest unsigned integral type */
  2134.   &builtin_type_m2_real,        /* longest floating point type */
  2135.   "0%XH", "0%", "XH",        /* Hex   format string, prefix, suffix */
  2136.   "%oB",  "%",  "oB",        /* Octal format string, prefix, suffix */
  2137.   m2_op_print_tab,        /* expression operators for printing */
  2138.   LANG_MAGIC
  2139. };
  2140.  
  2141. /* Initialization for Modula-2 */
  2142.  
  2143. void
  2144. _initialize_m2_exp ()
  2145. {
  2146.   /* FIXME:  The code below assumes that the sizes of the basic data
  2147.      types are the same on the host and target machines!!!  */
  2148.  
  2149.   /* Modula-2 "pervasive" types.  NOTE:  these can be redefined!!! */
  2150.   builtin_type_m2_int =  init_type (TYPE_CODE_INT, sizeof(int), 0, "INTEGER");
  2151.   builtin_type_m2_card = init_type (TYPE_CODE_INT, sizeof(int), 1, "CARDINAL");
  2152.   builtin_type_m2_real = init_type (TYPE_CODE_FLT, sizeof(float), 0, "REAL");
  2153.   builtin_type_m2_char = init_type (TYPE_CODE_CHAR, sizeof(char), 1, "CHAR");
  2154.  
  2155.   builtin_type_m2_bool = init_type (TYPE_CODE_BOOL, sizeof(int), 1, "BOOLEAN");
  2156.   TYPE_NFIELDS(builtin_type_m2_bool) = 2;
  2157.   TYPE_FIELDS(builtin_type_m2_bool) = 
  2158.      (struct field *) malloc (sizeof (struct field) * 2);
  2159.   TYPE_FIELD_BITPOS(builtin_type_m2_bool,0) = 0;
  2160.   TYPE_FIELD_NAME(builtin_type_m2_bool,0) = (char *)malloc(6);
  2161.   strcpy(TYPE_FIELD_NAME(builtin_type_m2_bool,0),"FALSE");
  2162.   TYPE_FIELD_BITPOS(builtin_type_m2_bool,1) = 1;
  2163.   TYPE_FIELD_NAME(builtin_type_m2_bool,1) = (char *)malloc(5);
  2164.   strcpy(TYPE_FIELD_NAME(builtin_type_m2_bool,1),"TRUE");
  2165.  
  2166.   add_language (&m2_language_defn);
  2167. }
  2168.